<template>
  <div class="dashboard-editor-container">
<!--    <el-row :gutter="10" class="mb8">-->
<!--      <el-col :span="1.5" v-if="btnShow">-->
<!--        <el-button-->
<!--          type="primary"-->
<!--          plain-->
<!--          icon="el-icon-edit"-->
<!--          size="mini"-->
<!--          @click="examineApply"-->
<!--        >{{ $t("toExamine") }}-->
<!--        </el-button>-->
<!--      </el-col>-->
<!--    </el-row>-->

    <el-table
      :data="applyExamineLogList?applyExamineLogList.slice((currentPage-1)*pageSize,currentPage*pageSize) : null"
      stripe
      :current-page.sync="currentPage"
      style="width: 100%">
      <el-table-column :label="$t('platformName')" align="center" prop="companyId"/>
      <el-table-column :label="$t('status')" align="center" prop="status">
        <template slot-scope="scope">
          <span v-if="scope.row.status == 1">{{ $t('examineStatus.pass') }}</span>
          <span v-if="scope.row.status == 2">{{ $t('examineStatus.refuse') }}</span>
        </template>
      </el-table-column>
      <el-table-column :label="$t('auditTime')" align="center" prop="status">
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.createTime) }}</span>
        </template>
      </el-table-column>
    </el-table>

    <div class="pagination">
      <el-pagination
        @size-change="handleSizeChange"
        @current-change="handleCurrentChange"
        :page-sizes="[10, 20, 50,100]"
        :page-size="pageSize"
        layout="total, sizes, prev, pager, next, jumper"
        :total="total">
      </el-pagination>
    </div>

<!--    <el-dialog :title="$t('toExamine')" :visible.sync="open" width="600px">-->
<!--      <el-form ref="form" :model="form" :rules="rules" label-width="120px">-->

<!--        <el-form-item :label="$t('product')" prop="productId" v-if="twoExamineType">-->
<!--          <el-select v-model="form.productId" clearable :placeholder="$t('pleaseSelect')" @change="tplSelectChange">-->
<!--            <el-option-->
<!--              v-for="item in applyProductList"-->
<!--              :key="item.id"-->
<!--              :label="item.name"-->
<!--              :value="item.id">-->
<!--              {{ item.applyMoney }} - {{ item.realApplyMoney }}-->
<!--            </el-option>-->
<!--          </el-select>-->
<!--        </el-form-item>-->

<!--        <el-form-item :label="$t('loanLimit')" v-if="twoExamineType">-->
<!--          <el-input v-model="applyInfo.realApplyMoney" disabled/>-->
<!--        </el-form-item>-->

<!--        <el-form-item :label="$t('cycle')" v-if="twoExamineType">-->
<!--          <el-input v-model="applyInfo.applyCycle" disabled>-->
<!--            <template slot="append">{{ $t('day') }}</template>-->
<!--          </el-input>-->
<!--        </el-form-item>-->

<!--        <el-form-item :label="$t('manageFee')" v-if="twoExamineType">-->
<!--          <el-input v-model="applyInfo.manageMoney" disabled/>-->
<!--        </el-form-item>-->

<!--        <el-form-item :label="$t('serviceFee')" v-if="twoExamineType">-->
<!--          <el-input v-model="applyInfo.serviceMoney" disabled/>-->
<!--        </el-form-item>-->

<!--        <el-form-item :label="$t('examineFee')" v-if="twoExamineType">-->
<!--          <el-input v-model="applyInfo.riskMoney" disabled/>-->
<!--        </el-form-item>-->

<!--        <el-form-item :label="$t('dayRate')" v-if="twoExamineType">-->
<!--          <el-input v-model="applyInfo.dayRate" disabled>-->
<!--            <template slot="append">%</template>-->
<!--          </el-input>-->
<!--        </el-form-item>-->

<!--        &lt;!&ndash;        <el-form-item :label="$t('actualAmount')" v-if="twoExamineType">&ndash;&gt;-->
<!--        &lt;!&ndash;          <el-input v-model="applyInfo.receiptMoney" disabled/>&ndash;&gt;-->
<!--        &lt;!&ndash;        </el-form-item>&ndash;&gt;-->

<!--        <el-form-item :label="$t('overRate')" v-if="twoExamineType">-->
<!--          <el-input v-model="applyInfo.expireRate" disabled>-->
<!--            <template slot="append">%</template>-->
<!--          </el-input>-->
<!--        </el-form-item>-->

<!--        <el-form-item :label="$t('frozen')" prop="frozenDay">-->
<!--          <el-input v-model="form.frozenDay" onkeyup="this.value=this.value.replace(/\D/g,'')">-->
<!--            <template slot="append">{{ $t('day') }}</template>-->
<!--          </el-input>-->
<!--        </el-form-item>-->

<!--        <el-form-item :label="$t('remarks')" prop="remark">-->
<!--          <el-input type="textarea" :rows="3" v-model="form.remark"></el-input>-->
<!--        </el-form-item>-->
<!--      </el-form>-->
<!--      <div slot="footer" class="dialog-footer" align="center">-->
<!--        <el-button type="primary" @click="examinePassHandler">{{ $t('examineStatus.pass') }}</el-button>-->
<!--        <el-button type="danger" @click="examineFailHandler">{{ $t('examineStatus.refuse') }}</el-button>-->
<!--        <el-button @click="open = false">{{ $t('cancel') }}</el-button>-->
<!--      </div>-->
<!--    </el-dialog>-->

  </div>
</template>
<script>
import {applyInfo, examineApply, getExamineLogList} from "@/api/app/apply";
import {listProduct} from "@/api/app/product";

export default {
  data() {
    return {
      applyExamineLogList: null,
      // applyProductList: null,
      applyInfo: {},
      open: false,
      loading: false,
      // btnShow: false,
      // twoExamineType: false,
      total: 0,
      pageSize: 10,
      currentPage: 1,
      queryParams: {
        pageNum: 1,
        pageSize: 10
      },
      // form: {},
      // rules: {
      //   productId: [
      //     {required: true, message: this.$t('pleaseSelect'), trigger: "blur"},
      //   ]
      // },
    }
  },
  methods: {
    /**  查询审核记录 */
    getExamineLogList(userId) {
      this.loading = true;
      getExamineLogList({userId: userId}).then(response => {
          this.applyExamineLogList = response.data;
          this.total = this.applyExamineLogList.length;
          this.loading = false;
        }
      );
    },

    //获取订单详情
    // getApplyInfo(id, userId) {
    //   if (id) {
    //     applyInfo({id: id, userId: userId}).then(response => {
    //         if (response.data && (response.data.status == '0' || response.data.status == '2')) {
    //           this.btnShow = true;
    //         }
    //       if (response.data.status == "2") {
    //         this.twoExamineType = true;
    //       } else {
    //         this.twoExamineType = false;
    //       }
    //       }
    //     );
    //   }
    // },

    // tplSelectChange(value) {
    //   this.applyProductList.forEach(item => {
    //     if (item.id == value) {
    //       this.applyInfo = item;
    //     }
    //   })
    // },

    // examineApply() {
    //   this.reset();
    //   listProduct().then(response => {
    //     this.applyProductList = response.data
    //   })
    //   this.open = true;
    // },


    // examinePassHandler() {
    //   this.form.status = '1';
    //   this.$refs["form"].validate(valid => {
    //     if (valid) {
    //       examineApply(this.form).then(response => {
    //         if (!this.twoExamineType) {
    //           const obj = {path: "/examine/firstIndex"};
    //           this.$tab.closeOpenPage(obj);
    //         } else {
    //           const obj = {path: "/examine/twoIndex"};
    //           this.$tab.closeOpenPage(obj);
    //         }
    //       })
    //     }
    //   })
    // },
    //
    // examineFailHandler() {
    //   this.form.status = '2';
    //   this.$refs["form"].validate(valid => {
    //     examineApply(this.form).then(response => {
    //       if (!this.twoExamineType) {
    //         const obj = {path: "/examine/firstIndex"};
    //         this.$tab.closeOpenPage(obj);
    //       } else {
    //         const obj = {path: "/examine/twoIndex"};
    //         this.$tab.closeOpenPage(obj);
    //       }
    //     })
    //   })
    // },
    //
    // reset() {
    //   this.form = {
    //     id: this.$route.params.applyId,
    //     remark: undefined,
    //     productId: undefined,
    //     status: undefined,
    //     frozenDay: 0,
    //   }
    // },

    handleSizeChange(val) {
      this.pagesize = val;
    },
    handleCurrentChange(val) {
      this.currentPage = val;
    },
  }
}
</script>
